package cn.edkuir.auth;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;

/**
 * 1. @EnableRedisHttpSession 导入 RedisHttpSessionConfiguration 配置类
 *      1) 添加组件 RedisIndexedSessionRepository: redis操作session, 增删改查封装类
 *      2) 父类组件 SessionRepositoryFilter(Filter): session过滤器, 每个请求过来都要经过filter
 *          1. 创建的时候自动从容器中获取到了 SessionRepository
 *          2. 原生的request、response被包装成SessionRepositoryRequestWrapper、SessionRepositoryResponseWrapper
 *          3. 获取session需要通过 request.getSession()
 *          4. wrappedRequest.getSession() => SessionRepository 中获取到的, 也就是从redis中获取
 *
 *  装饰者模式
 */
@EnableRedisHttpSession
@EnableFeignClients
@EnableDiscoveryClient
@SpringBootApplication
public class MallAuthServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(MallAuthServerApplication.class, args);
    }

}
